package org.example.springaop.house;

import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 九转苍翎
 * Date: 2025/8/1
 * Time: 22:05
 */
//中介
@Configuration
public class HouseProxy implements IHouse {

    private final IHouse realHouse;

    public HouseProxy(IHouse realHouse) {
        this.realHouse = realHouse;
    }

    @Override
    public void rent() {
        System.out.println("开始代理");
        realHouse.rent();
        System.out.println("结束代理");
    }

    @Override
    public void sell() {
        System.out.println("开始代理");
        realHouse.sell();
        System.out.println("结束代理");
    }

    public static void main(String[] args) {
        IHouse iHouse = new HouseProxy(new RealHouse());
        iHouse.rent();
        iHouse.sell();
    }
}
